//package com.train.order.core.config.sentinel;
//
//import com.alibaba.csp.sentinel.slots.block.RuleConstant;
//import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
//import com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager;
//import com.train.common.constants.SentinelRscConstants;
//import jakarta.annotation.PostConstruct;
//import org.springframework.stereotype.Component;
//
//import java.util.ArrayList;
//import java.util.List;
//
//@Component
//public class SentinelFlowRulesConfig {
//
//    @PostConstruct
//    public static void initFlow() {
//        List<FlowRule> flowRules = new ArrayList<>();
//        FlowRule flowRule = new FlowRule();
////        flowRule.setGrade(RuleConstant.FLOW_GRADE_THREAD); //每秒线程数限流
//        flowRule.setGrade(RuleConstant.FLOW_GRADE_QPS); //每秒查询请求数限流
//        flowRule.setCount(1); //每秒一个查询请求或一个线程请求
////        flowRule.setResource("confirmProcess"); //限流的资源
//        flowRule.setResource(SentinelRscConstants.RSC_NAME_CONFIRM_ORDER); //限流的资源
//        flowRules.add(flowRule);
//        FlowRuleManager.loadRules(flowRules);
//    }
//}
